{% load static %}

<table class="list" id="id_table_cases" cellspacing="0" cellspan="0">
	<thead>
		<tr>
			<th width="20">
				<input id="id_check_all_button" type="checkbox" title="Select all cases/Select none case" />
			</th>
			<th width="18">
				<a id="id_blind_all_link" title="Expand all cases">
					<img id="id_blind_all_img" src="{% static 'images/t1.gif' %}" border="0" alt="" class="collapse-all">
				</a>
			</th>
			<th class="widthID">Case Run ID</th>
			<th class="widthID">Case ID</th>
			<th>Summary</th>
			<th width="80">Tester</th>
			<th width="80">Assignee</th>
			<th width="140">Automated </th>
			<th width="100">Category</th>
			<th width="50">Priority</th>
			<th width="40">Bugs</th>
			<th width="50" style='text-align:center'>Status</th>
			<th width="65">Comments</th>
		</tr>
	</thead>
	<tbody>
		{% for test_case_run, tester, assignee, priority_value, status_name, comments_count in test_case_runs %}
		<tr class="{% cycle 'odd' 'even' %} {% ifequal test_case_run.assignee_id user.pk %} mine {% endifequal %}">
			<td>
				<input type="checkbox" name="case_run" value="{{ test_case_run.pk }}" class="caserun_selector" title="Select/Unselect" />
				<input type="hidden" name="case" value="{{ test_case_run.case.pk }}" />
				<input type="hidden" name="case_text_version" value="{{ test_case_run.case_text_version }}" />
			</td>
			<td title="expand test case" class="expandable vmiddle case_title">
				<img class="blind_icon expand" src="{% static 'images/t1.gif' %}" border="0" alt="" />
			</td>
			<td class="case_title expandable">
				<a href="#caserun_{{ test_case_run.pk }}">#{{ test_case_run.pk }}</a>
			</td>
			<td "{{ test_case_run.case_id }}" class="case_title expandable">
				<a href="{% url "testcases-get" test_case_run.case_id %}?from_plan={{ test_case_run.run.plan_id }}">{{ test_case_run.case_id }}</a>
			</td>
			
			<td class="expandable">
				<a id="link_{{ forloop.counter }}" href="#caserun_{{ test_case_run.pk }}" title="Expand test case">{{ test_case_run.case.summary }}</a>
			</td>
			<td>
				{% if tester %}
				<a href="{% url "tcms-profile" tester %}" class="link_tested_by">{{ tester }}</a>
				{% else %}
				<a class="link_tested_by">None</a>
				{% endif %}
			</td>
			<td>
				{% if assignee %}
				<a href="{% url "tcms-profile" assignee %}" class="link_assignee">{{ assignee }}</a>
				{% else %}None{% endif %}
			</td>
			<td class="expandable">{{ test_case_run.case.get_is_automated_status }}</td>
			<td class="expandable">{{ test_case_run.case.category }}</td>
			<td class="expandable">{{ priority_value }}</td>
			<td class="expandable"><span id="{{ test_case_run.pk }}_case_bug_count" {% if test_case_run.num_bug %}class="have_bug"{% endif %}>{{ test_case_run.num_bug }}</span></td>
			<td class="expandable center">
				<img border="0" alt="" class="icon_status btn_{{ status_name|lower }}" />
			</td>
			<td><div id="{{ test_case_run.case_id }}_case_comment_count">{% if comments_count %}<img src="{% static 'images/comment.png' %}" style="vertical-align: middle;">{%endif %} <span id="{{ test_case_run.case_id }}_comments_count">{{ comments_count }}</span></div></td>
		</tr>
		<tr class="case_content hide js-details-caserun" style="display: none;">
			<td id="id_loading_{{ test_case_run.case_id }}" class="left_panel" colspan="14">
				<div class="ajax_loading"></div>
			</td>
		</tr>
		{% empty %}
		<tr>
			<td colspan="13" align="center">No case run found</td>
		</tr>
		{% endfor %}
	</tbody>
</table>
